home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-03 | 3.7 KB | 101 lines | [TEXT/KAHL] |
- //CVScrollBar.hpp
- //Interface of the class CVScrollBar
- //Superclass - CScrollBar
- //Date - March 17, 1994
- //© 1994 by Vladimir Potap'yev, Manley & Associates, Inc.
-
-
- /****************************************************************************************************
-
- This subclass of CScrollBar is intended to serve as a substitute for CScrollBar class
- in TCL-based programs. CScrollBar uses DoClick method inherited from CControl which is
- rather anemic and does not provide such necessities as action procedure to be called
- when user is pressing mouse in stationary parts of the scroll bar or such goodies as
- "live scrolling". All this is remedied in this class.
-
- This class adds an instance variable, itsScrollCmd, that srings to action at any time control
- value in scroll bar has changed. Another instance variable is itsPageValue. We use it when
- user is clicking in inPageDown or inPageUp so that we could scroll a "page" at a time. Client
- of the class has to figure out what this value will be for the intended use and set the
- variable accordingly. The real job of updating the scrolled area is entrusted
- to the supervisor of the scroll bar. The probable course of action will be upon receiving
- the command from the scroll bar to get the current value and approprietly update the display.
- All in all, I think this class is fairly complete, however, I would welcome any suggestions
- and improvements.
-
- I'd like to thank Chris Wysocki for his suggestion of how to implement "live scrolling". He
- described the general idea here at AOL, and I filled in the blanks. There is one area which
- needs to be worked on. When you scroll very fast to the left or down (depending on the
- orientation of the scroll bar) and get to the minimum value, the indicator sometimes jumps
- to the maximum value. I also noticed this behavior with the new Metrowerks compiler in their
- implementation of "live scrolling". I suspect that in these cases the new value to be
- assigned to the contrlValue field is below minimum value allowed for this control, and
- Control Manager compensates for it by moving it to the maximum. Control value overflow, if
- you will. I tried to resolve this problem but was not very successful. My only consolation
- right now is that I am not the only one who got bit by this bug :-). I'll post the update when
- I figure this one out. Meanwhile, I'd be glad if someone else could come up with the
- solution.
-
- Enjoy and make classes of your own available to general public as well.
-
- Vladimir Potap'yev,
- Manley & Associates, Inc.
- Issaquah, WA
- VolodyaP at AOL
- fax (206) 557-9039
-
- ****************************************************************************************************/
-
- //notice that we avoid #pragma once directive as it makes code unportable
-
- #ifndef CVScrollBar_H
- #define CVScrollBar_H
-
- #include <CScrollBar.h>
-
-
- class CVScrollBar : public CScrollBar
- {
- protected:
- /* Instance variables */
-
- long itsScrollCommand;
-
- short itsPageValue;
-
- /* Instance methods */
-
- public:
-
- /* Construction method */
-
- void IVScrollBar (
- CView *anEnclosure,
- CBureaucrat *aSupervisor,
- Orientation anOrientation,
- short aLength,
- short aHEncl,
- short aVEncl
- );
-
-
- /* Overridden methods */
-
- void DoClick (Point hitPt, short modifiers, long when);
-
- void DoGoodClick (short whichPart);
-
- /* Command methods */
-
- void SetScrollCmd (long aCommand);
-
- long GetScrollCmd (void);
-
- /* Other methods */
-
- void SetPageValue (short aValue);
-
- short GetPageValue (void);
- };
-
- #endif